﻿<Application x:Class="AdventureWorks.Client.WPF.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:xom="clr-namespace:Xomega.Framework;assembly=Xomega.Framework"
    StartupUri="_EmployeeSearch.xaml" Startup="Application_Startup" DispatcherUnhandledException="Application_DispatcherUnhandledException">
    <Application.Resources>
        <Style x:Key="RadioButtonListStyle" TargetType="{x:Type ListBox}">
            <Setter Property="ItemContainerStyle">
                <Setter.Value>
                    <Style TargetType="{x:Type ListBoxItem}" >
                        <Setter Property="Margin" Value="2" />
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ListBoxItem}" >
                                    <RadioButton Focusable="False" IsChecked="{Binding Path=IsSelected,
                                        Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
                                        <ContentPresenter></ContentPresenter>
                                    </RadioButton>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </Setter.Value>
            </Setter>
        </Style>
        <ControlTemplate x:Key="validationTemplate">
            <DockPanel>
                <TextBlock Foreground="Red" Text="*" FontSize="18" FontWeight="Bold"
                           ToolTip="{Binding ElementName=adornerPlaceholder, Path=AdornedElement.(xom:Property.Validation).Errors.ErrorsText}" />
                <AdornedElementPlaceholder Name="adornerPlaceholder"/>
            </DockPanel>
        </ControlTemplate>
        <Style x:Key="LabelStyle" TargetType="{x:Type Label}">
            <Style.Triggers>
                <Trigger Property="xom:Property.Required" Value="True">
                    <Setter Property="FontWeight" Value="Bold"/>
                </Trigger>
            </Style.Triggers>
        </Style>
        <Style x:Key="OperatorStyle" TargetType="{x:Type ComboBox}">
            <Setter Property="Margin" Value="5"/>
            <Setter Property="VerticalAlignment" Value="Top"/>
        </Style>
        <Style x:Key="ControlStyle" TargetType="{x:Type FrameworkElement}">
            <Setter Property="Margin" Value="5"/>
            <Setter Property="VerticalAlignment" Value="Top"/>
            <Setter Property="Validation.ErrorTemplate" Value="{StaticResource validationTemplate}"/>
        </Style>
        <Style x:Key="CriteriaStyle" TargetType="{x:Type Control}">
            <Setter Property="Margin" Value="5"/>
            <Setter Property="Validation.ErrorTemplate" Value="{StaticResource validationTemplate}"/>
        </Style>
    </Application.Resources>
</Application>
